package com.cari.oa.dao;


import java.util.List;
import java.util.Map;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import com.cari.oa.domain.ReqTypeEntity;

@Repository
public class ReqTypeDao extends BaseDao<ReqTypeEntity> {
	
    /**
    * Title: getUserByProjectId
    * Description:获取项目底下的人员信息
    * @author    hjx 
    * @date       2013-1-30 
    * @param projectId
    * @return
    */
    @SuppressWarnings("unchecked")
	public List<Map<String,String>> getReqTypeNameAndPerson() {
	     StringBuilder hql = new StringBuilder();
	     hql.append(" select new map(rt.id as typeId,u.cnname as cnName,rt.name as typeName) from  ReqTypeEntity rt,ReqUserRefEntity ru,SysUserEntity u");
	     hql.append(" where ");
	     hql.append(" rt.id = ru.typeId");
	     hql.append(" and ru.enname = u.enname");
	     Query query = getSession().createQuery(hql.toString());
	     return  query.list();      
	}	
}
